/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.tramite.be.DirRecep;

/**
 *
 * @author ChristianATE
 */
public class DirRecepDelegate {

    private DirRecepFacadeLocal local;

    public DirRecepDelegate() {
        local=lookupDirRecepFacade();
    }
    
    public void create(DirRecep dirRecep){
        local.create(dirRecep);
    }

    public void edit(DirRecep dirRecep){
        local.edit(dirRecep);
    }

    public void remove(DirRecep dirRecep){
        local.remove(dirRecep);
    }

    public DirRecep find(Object id){
        return local.find(id);
    }

    public List<DirRecep> findAll(){
        return local.findAll();
    }

    private DirRecepFacadeLocal lookupDirRecepFacade() {
        try {
            Context c = new InitialContext();
            return (DirRecepFacadeLocal) c.lookup("java:comp/env/DirRecepFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

}
